#include <Editor/StdAfx.h>
#include <Editor/MessageWindow.h>

#define MESSAGE_WINDOW_LINE_SIZE 1000
MessageWindow::MessageWindow(wxWindow* parent)
	: wxTextCtrl(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 
			wxTE_MULTILINE | wxTE_READONLY)
{

}

void MessageWindow::AppendText(const wxString& message)
{
	if (message.empty())
		return;
	if (this->GetNumberOfLines() > MESSAGE_WINDOW_LINE_SIZE)
	{
		this->Clear();
	}
	wxDateTime t = wxDateTime::Now();
	wxTextCtrl::AppendText(_T("[") + t.FormatTime() + _T("] ") + message);
	wxTextCtrl::AppendText(_T("\n"));
}